package com.leo.filter;

import com.leo.util.JsonUtil;
import com.leo.util.ValidateCodeUtil;
import com.leo.vo.Result;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class ValidateInterceptor extends MethodFilterInterceptor {

	private static final long serialVersionUID = -782706110048048600L;

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		if (!ValidateCodeUtil.validate()) {
			//System.out.println("验证码错误");
			JsonUtil.output(Result.validataCodeIncorrect());
			return null;
		}
		return invocation.invoke();
	}
}
